Skip to content

cache sql.Schema in plan.Project and plan.TableAlias#3158

Merged
jycor merged 12 commits intomainfrom
james/schema
Aug 19, 2025
Merged

cache sql.Schema in plan.Project and plan.TableAlias#3158
jycor merged 12 commits intomainfrom
james/schema

Conversation

@jycor
Copy link
Copy Markdown
Contributor

@jycor jycor commented Aug 13, 2025

Changes:

  • plan.Project.Schema() and plan.TableAlias.Schema() create a new sql.Schema every time they are called, which can be a lot during analysis. So, the results are cached.
  • sql.Index.Expressions() retrieves a new []string, so we should cache that as well. Additionally, many times we unqualify the results, so I added a UnqualifiedExpressions() to avoid doing this extra processing every time.
  • changes idxExprsColumns to avoid using strings.Split to avoid extra allocations

Copy link
Copy Markdown
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jycor jycor changed the title cache sql.Schema cache sql.Schema in plan.Project and plan.TableAlias Aug 19, 2025
@jycor jycor merged commit f927685 into main Aug 19, 2025
8 checks passed
@Hydrocharged Hydrocharged deleted the james/schema branch December 17, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants